/*
	微信的api封装
*/

export default{
	/*
		@request发起 HTTPS 网络请求
		@param
			url:接口地址
			data:请求接口数据
			header:请求头
			method:HTTP 请求方法
			success(res):接口调用成功返回
			fail(res):接口调用失败返回

	*/
	request(param){
		wx.request({
			url:param.url,
			data:param.data,
			header:param.header?param.header:{"content-type":"application/json"},
			method:param.method?param.method:"GET",
			success(res){
				param.success&&param.success(res);
			},
			fail(res){
				param.fail&&param.fail(res);
			}
		})
	},

	/*
		@shareAppMessage小游戏分享
	*/
	shareAppMessage(param){
		console.log("param",param)
		param=param?param:{};
		wx.shareAppMessage({
			title:param.title?param.title:"",
			imageUrl:param.imageUrl?param.imageUrl:"",
			query:param.query?param.query:"",
			imageUrlId:param.imageUrlId?param.imageUrlId:"",
		})
	},

	/*
		@showShareMenu打开小程序右上角分享
	*/
	showShareMenu(){
		wx.showShareMenu({
			withShareTicket: true,
			menus: ['shareAppMessage', 'shareTimeline']
		})
	}



}